package dcc.service;

import java.util.List;

import dcc.model.User;
import dcc.persistence.UserMapper;

public class UserService extends BaseService {

	private UserMapper userMapper;

	public void setUserMapper(UserMapper userMapper) {
		this.userMapper = userMapper;
	}

	public UserService() {
		super(UserService.class);
	}

	public User checkUser(User user) {
		return userMapper.getUserByUserNameAndPassword(user);
	}

	public void changePassword(User user) {
		userMapper.updatePassword(user);
	}

	public List<User> getAllUser() {
		return userMapper.selectAllUser();
	}

	public void update(User user) {
		userMapper.update(user);
	}

	public User gettUserByUserName(User user) {
		return userMapper.selectUserByUserName(user);
	}

	public void insert(User user) {
		userMapper.insert(user);
	}

	public void removeUserByUserName(String userName) {
		userMapper.deleteByUserName(userName);
	}
}